package controls.visu;

import gui.visu.components.Curve;

import java.awt.Color;

import data.visu.DisplayDataList;
import data.visu.datasets.CurveDataSet;
import data.visu.enums.E_CurveTypes;
import data.visu.enums.E_DisplayDataTypes;


/**
 * @author Charles Perin
 * 29 mars 2011
 * LIMSI - INRIA Rennes
 * charles.perin@free.fr
 *
 */
public class CurveControl extends A_DisplayDataControl{


	/**
	 * permet de restaurer la vue initiale 
	 */
	protected double yMaxViewAbsolute, yMinViewAbsolute;

	private E_CurveTypes curveType;

	public CurveControl(String name, Color color, DisplayDataList displayDataList, E_CurveTypes type){
		super(name, displayDataList, E_DisplayDataTypes.CURVE, color);

		setComparable(type.isComparable());

		setType(E_DisplayDataTypes.CURVE);
		setCurveType(type);
		setDataSet(new CurveDataSet());

		setyMinView(0);
		setyMaxView(type.getyMax());
		setyMaxViewAbsolute(type.getyMax());
		setyMinViewAbsolute(type.getyMin());
	}

	@Override
	protected void load_SetSubType(int typeIndex){
		E_CurveTypes[] curveTypes = E_CurveTypes.values();
		setCurveType(curveTypes[typeIndex]);
	}
	
	@Override
	protected int save_GetSubType(){
		return curveType.ordinal();
	}

	//Getters & Setters

	public void setyMaxViewAbsolute(double yMaxViewAbsolute) {
		this.yMaxViewAbsolute = yMaxViewAbsolute;
	}

	public double getyMaxViewAbsolute() {
		return yMaxViewAbsolute;
	}

	public void setCurve(Curve curve) {
		this.a_DisplayData = curve;
	}

	public Curve getCurve() {
		return (Curve) a_DisplayData;
	}

	public void setCurveType(E_CurveTypes curveType) {
		this.curveType = curveType;
	}

	public E_CurveTypes getCurveType() {
		return curveType;
	}

	public double getyMinViewAbsolute() {
		return yMinViewAbsolute;
	}

	public void setyMinViewAbsolute(double yMinViewAbsolute) {
		this.yMinViewAbsolute = yMinViewAbsolute;
	}
}
